/* 
 * File:   GradientDataset.cpp
 * Author: a1574256
 * 
 * Created on January 11, 2013, 2:04 PM
 */

#include "GradientDataset.h"
#include "ScalarDataset.h"

GradientDataset::GradientDataset(ScalarDataset *dat, int dim)
{
    d_data = dat;
    d_dim = dim;
}

Vector2f GradientDataset::getData(int idx)
{
    double dx = d_data->getData(idx + 1) - d_data->getData(idx);
    double dy = d_data->getData(idx + d_dim) - d_data->getData(idx);
    return Vector2f(dx, dy);
}

